func send<%= resource_name %><%= titlelize(api.name) %>Request(<%= input_url ? "" : "d *schema.ResourceData, " %>client *golangsdk.ServiceClient<%= input_url ? ", url string" : "" %>) (interface{}, error) {
<% unless input_url -%>
<%   if api.path.include?("{") -%>
    url, err := replaceVars(d, "<%= api.path -%>", nil)
    if err != nil {
        return nil, err
    }
    url = client.ServiceURL(url)
<%   else -%>
    url := client.ServiceURL(<%= sprintf("\"%s\"", api.path) %>)
<%   end -%>

<% end -%>
    r := golangsdk.Result{}
    _, r.Err = client.<%= api.verb.capitalize %>(url, &r.Body, &golangsdk.RequestOpts{
      <% if api.header_params.nil? -%>
        MoreHeaders: map[string]string{"Content-Type": "application/json"}})
      <% else -%>
        MoreHeaders: map[string]string{
            "Content-Type": "application/json",
        <% api.header_params.each do |k, v| -%>
            <%= sprintf("\"%s\": \"%s\",", k, v)%>
        <% end -%>
        }})
      <% end -%>
    if r.Err != nil {
        return nil, fmt.Errorf("Error running api(<%= api.name %>) for resource(<%= resource_name%>), err=%s", r.Err)
    }

<% if api.msg_prefix.nil? -%>
    return r.Body, nil
<% else -%>
<%   ai = "nil" -%>
<%   unless api.msg_prefix_array_items.nil? -%>
<%   ai = "arrayIndex" -%>
    arrayIndex = map[string]int {
<%     api.msg_prefix_array_items.each do |i| -%>
	"<%= i %>": 0,
<%     end -%>
    }
<%   end -%>
    v, err := navigateValue(r.Body, []string{<%= index2navigate(api.msg_prefix) %>}, <%= ai %>)
    if err != nil {
            return nil, err
    }
    return v, nil
<% end -%>
}
